<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="/opebs/date/css/bootstrap-datetimepicker.css">

<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="/opebs/date/js/bootstrap-datetimepicker.js"></script>

<link href="/lib/ueditor/themes/css/umeditor.css" type="text/css" rel="stylesheet">
<script type="text/javascript" charset="utf-8" src="/lib/ueditor/js/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/lib/ueditor/js/editor_api.js"></script>
<script type="text/javascript" src="/lib/ueditor/lang/zh-cn/zh-cn.js"></script>

 <link href="/bootstrap-fileinput-master/css/fileinput.css" media="all" rel="stylesheet" type="text/css"/>
<script src="/bootstrap-fileinput-master/js/fileinput.js" type="text/javascript"></script>
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>

<body>
<form class="form-horizontal" id="form-meet-add" style="margin-top: 1%">

    <div class="form-group has-success">
        <label class="col-sm-2 control-label" for="inputSuccess">时间</label>
        <div class="col-sm-9">
        <div class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd" data-link-field="errorTime" data-link-format="yyyy-mm-dd">
            <input class="form-control" size="14" type="text" value="<#if error??>${error.errorTime!}</#if>" readonly>
            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
        </div>
        <input type="hidden" id="errorTime" value="" />
        </div>
    </div>
    <div class="form-group has-success">
        <label class="col-sm-2 control-label" for="inputSuccess">
            事项
        </label>
        <div class="col-sm-9">
            <script type="text/plain" id="myEditor" style="width:100%;height:150px;"><#if error??>${error.errorContent!}</#if></script>
        </div>
    </div>
    <div class="form-group  has-success">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="button" id="save" class="btn btn-default">保存</button>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    $('.form_date').datetimepicker({
        language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0
    });
    var um = UM.getEditor('myEditor',{
        //这里可以选择自己需要的工具按钮名称,此处仅选择如下七个
        toolbar:['fullscreen source undo redo bold italic underline'],
        //focus时自动清空初始化时的内容
        autoClearinitialContent:false,
        //关闭字数统计
        wordCount:false,
        //关闭elementPath
        elementPathEnabled:false,
        //默认的编辑区域高度
        initialFrameHeight:300
        //更多其他参数，请参考umeditor.config.js中的配置项
    });
</script>
<script>

    var id = ${id};
    var localId = ${localId};
    $("#input-b2").fileinput({
        language : 'zh',//设置文中文
        uploadUrl : "/upload-json/YC/"+id,//图片上传的url，我这里对应的是后台struts配置好的的action方法
        showCaption : true,//显示标题
        showRemove : true, //显示移除按钮
        uploadAsync : true,//默认异步上传
        textEncoding : "UTF-8",//文本编码
    });
    $("#input-b2").on('fileuploaded', function(event, data, previewId, index) {//异步上传成功结果处理
    });
    $("#input-b2").on('fileerror', function(event, data, msg) {//异步上传失败结果处理
    });
    $('#save').click(function () {
        var errorTime = $('#errorTime').val();
        var content = um.getPlainTxt();
        $.ajax({
            url:"/error-ins-upd-del",
            data:{errorTime:errorTime,errorContent:content,id:localId,proID:id},
            async: false,
            success: function(data) {
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
                parent.$('#errorproject_table').datagrid('reload');
            }
        })
    })
</script>
